attribute vec3 a_posL;
attribute vec2 a_uv;
attribute vec3 a_normal;

uniform mat4 u_mvp;
uniform mat4 u_matTransposeInverseViewModel;

varying vec2 v_uv;
varying vec4 v_ambient;
varying vec4 v_diffuse;

void main()
{
	 vec3 light_position=vec3(1.0,1.0, 1.0);
	 vec4 light_ambient=vec4(0.3, 0.3, 0.3, 1.0);
	 vec4 light_diffuse=vec4(0.9, 0.9, 0.9, 1.0);

	vec4 posL = u_mvp * vec4(a_posL, 1.0);
	gl_Position = posL;
	v_uv = a_uv;
//

   vec3 normalVector = normalize(mat3(u_matTransposeInverseViewModel)*a_normal);
   vec3 lightVector = normalize(light_position);
   float NDotL = max( 0.0 , dot(normalVector, lightVector));
   v_diffuse = light_diffuse * NDotL;
   v_ambient = light_ambient;
}